<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/5/18 0018
 * Time: 9:51
 */

/**
 * 获取店铺审核状态
 * @param $status
 * @return mixed
 */
function get_shop_status($status) {
    $status_array = ['未申请', '待审核', '审核通过', '审核失败', '关闭'];
    return $status_array[$status];
}

/**
 * 返回json格式数据
 * @param $code
 * @param array $data
 * @param string $msg
 * @return string
 */
function return_json($code, $data=[], $msg='') {
    return json_encode(['code' => $code, 'data' => $data, 'msg' => $msg]);
}

/**
 * 生成配置文件
 */
function update_config() {
    $config = model('config')->select();
    foreach ($config as $v) {
        $system[$v['name']] = $v['value'];
    }
    file_put_contents('../application/extra/system.php', "<?php\treturn " . var_export($system, true) . ";");
}